/*------------------------------------------------------*/
/* normal session base define                           */
/*                                                      */
/* sessbase.h                                           */
/*                                                      */
/* Copyright (C) CyberNaut.com.cn                       */
/* All rights reserved                                  */
/*                                                      */
/* Author                                               */
/*    Jobs Chen (jobs.chen@cybernaut.com.cn)            */
/*                                                      */
/* History                                              */
/*    03/23/2006  Create                                */
/*                                                      */
/*------------------------------------------------------*/

#ifndef __RT_SESS_BASE_H__
#define __RT_SESS_BASE_H__

#include "cmnetbase.h"

typedef WORD	CSessionType;

typedef enum
{
	RT_SESS_NONE	= 0,
	RT_SESS_TYPE_IM		= 1,	//no use
	RT_SESS_TYPE_MEMBERMGR	=	2,//no use
	RT_SESS_TYPE_CHAT = 4,
	RT_SESS_TYPE_FILETRANSFER=8,

	RT_SESS_TYPE_VOIP_PC=16,//voip
	RT_SESS_TYPE_VIDEO=32,
	RT_SESS_TYPE_VOIP_PSTN = 64,//no use
	RT_SESS_TYPE_ONLY_2		= 128,//no use
	RT_SESS_TYPE_PD = 256,//ds
	RT_SESS_TYPE_AV_SHARE = 512,
	RT_SESS_TYPE_QA = 1024 ,//Q&A
	RT_SESS_TYPE_AS = 2048,
	RT_SESS_TYPE_POLLING = 4096,
	RT_SESS_TYPE_AGENT = 8192,//sub conference
	RT_SESS_TYPE_CB = 16384,
	RT_SESS_TYPE_ALLOW_P2P	=32768//no use
}RT_SESS_TYPE;

typedef DWORD	TransportHandle;

typedef enum {
	RT_SERVER_STARTING = 0,
	RT_SERVER_OPEN = 1,
	RT_SERVER_SUSPENDED,
	RT_SERVER_DOWN,
	RT_SERVER_ERROR,
	RT_SERVER_KICKOUT, // Set by GC to actively close the connection with server of peer cluster.
} ServerStatus;

typedef enum
{	
	CONF_STATUS_PENDING = 0,
	CONF_STATUS_JBH = 1,
	CONF_STATUS_OPEN = 2,	
	CONF_STATUS_LOCK = 4,
	CONF_STATUS_HOST_LEAVE = 8,
	CONF_STATUS_CLOSED = 16,
	CONF_STATUS_AUTO_CLOSED = 32, 
	/// Below status are set by GC.
	CONF_STATUS_UNINIT = 99, // Triggered by GC creating a new conference.
 	CONF_STATUS_INIT = 100, // Triggered by GC creating a new conference.
  	CONF_STATUS_SERVER_PENDING, // Triggered by GC selecting a root server for a new conference.
	CONF_STATUS_ROOTSVR_DOWN = 200, // Triggered by root server down.
	CONF_STATUS_RECOVERING, // Triggered by GC selecting a new root server after root server down.
}CONF_STATUS_TYPE;

enum
{
	RT_CONF_OPT_BASE		= 0x1000,
	RT_SESS_OPT_BASE		= 0x1100,
	RT_CONF_OPT_SVR_ADDRESS = RT_CONF_OPT_BASE + 1,
	RT_CONF_OPT_SECURITY_TYPE = RT_CONF_OPT_BASE + 2,
	RT_CONF_OPT_SECURITY_RANDSTRING = RT_CONF_OPT_BASE + 3,
	RT_CONF_OPT_SEND_BANDWITH		= RT_CONF_OPT_BASE + 4,
	RT_CONF_OPT_RECV_BANDWITH		= RT_CONF_OPT_BASE + 5,
	RT_CONF_OPT_P2P_SUPPORT			= RT_CONF_OPT_BASE + 6,
	RT_CONF_OPT_AUDIO_TCP			= RT_CONF_OPT_BASE + 7, // default is rudp
	RT_SESS_OPT_DATATRANSPORT_TYPE = RT_SESS_OPT_BASE + 1, //BOOL, TRUE is udp, FALSE is tcp.
	RT_SESS_OPT_SUPPORT_SECURITY =  RT_SESS_OPT_BASE + 2,
	RT_SESS_OPT_SESSION_SECURITY =  RT_SESS_OPT_BASE + 3,
	RT_SESS_OPT_SHAREDATA_SECURITY =  RT_SESS_OPT_BASE + 4,
	RT_SESS_OPT_SHAREDATA_OWN		=  RT_SESS_OPT_BASE + 5,
	RT_SESS_OPT_CANSENDASDATA		=  RT_SESS_OPT_BASE + 6,
	RT_SESS_OPT_ROSTERINFO			=  RT_SESS_OPT_BASE + 7,
	RT_SESS_OPT_OLDUSERID			=  RT_SESS_OPT_BASE + 8,
	RT_SESS_OPT_DROPFRAME			=  RT_SESS_OPT_BASE + 9,
};

typedef enum
{
	SECURITY_TYPE_NONE	  = 0,
	SECURITY_TYPE_AES_256
}SecurityType;

typedef enum {
	RT_LICENSE_TYPE_NONE = 0,
	RT_LICENSE_TYPE_CONF,
	RT_LICENSE_TYPE_SERVICE,
}LicenseType;

enum
{
	RT_CONNECT_TYPE_CONF = 1
};

enum
{
	RT_ENROLL_TYPE_VISIBLE	= 0x0001,
	//client can see all other client
	RT_ENROLL_TYPE_SECURITY	= 0x0002,
	//
	RT_ENROLL_TYPE_RECEIVE_VISIBLE	=0x0010,
	RT_ENROLL_TYPE_RECEIVE_ALL	= 0x0020,
	RT_ENROLL_TYPE_RECEIVE_LOCAL	= 0x0040
};

//
enum
{
	RT_CONF_FLAG_JBH_EN = 1 << 31, //enable join-before-host
	RT_CONF_FLAG_REPING = 1 << 30, //re-join flag.
	RT_CONF_FLAG_REAL_BILLING = 1 << 29,
	RT_CONF_FLAG_AUTO_END = 1 << 28, //auto end 
	RT_CONF_FLAG_FIXED = 1 << 27, //fixed(period) conf 
	RT_CONF_FLAG_TESTING = 1 << 26, //testing conf 

//	RT_CONF_FLAG_AV_NUM_4 = 1 << 28, //4
//	RT_CONF_FLAG_AV_NUM_6 = 1 << 27, //6
//	RT_CONF_FLAG_AV_NUM_8 = 1 << 26, //8
//	RT_CONF_FLAG_AV_NUM_12 = 1 << 25, //12
//	RT_CONF_FLAG_AV_NUM_16 = 1 << 24 //16
};


enum INFO_ROLE
{
// Role
	RT_ROLE_HOST			= (1 << 31),       // host(1)
	RT_ROLE_PRESENTOR		= (1 << 30),       // presenter(1)
	RT_ROLE_ASSISTANT		= (1 << 29),       // assistant(4)
	RT_ROLE_ATTENDEE		= (1 << 28),       // attendee(n)

	RT_ROLE_AUDIENCE		= (1 << 1),        // audience
	RT_ROLE_H323			= (1 << 2),        // H323 gateway
	RT_ROLE_TELEPHONE		= (1 << 3),        // pstn phone
	RT_ROLE_DVR				= (1 << 4),        // dvr user
	RT_ROLE_SIP				= (1 << 5),        // sip user
	RT_ROLE_HIDEATTENDEE	= (1 << 6),		   // hide attendee
};

#define RT_ROLE_MASK			(RT_ROLE_HOST|\
								RT_ROLE_PRESENTOR|\
								RT_ROLE_ASSISTANT|\
								RT_ROLE_ATTENDEE|\
								RT_ROLE_AUDIENCE|\
								RT_ROLE_H323)

enum INFO_PRIVILEDGE
{
	RT_PRIVILEDGE_AV_AUDIO			= (1 << 31),
	RT_PRIVILEDGE_AV_VIDEO			= (1 << 30),
	RT_PRIVILEDGE_AV_LOOP			= (1 << 29),

	RT_PRIVILEDGE_DS_DOCUMENT		= (1 << 28),
	RT_PRIVILEDGE_DS_PAGE			= (1 << 27),
	RT_PRIVILEDGE_DS_ANNOTATION		= (1 << 26),
	RT_PRIVILEDGE_DS_SAVE			= (1 << 25),

	RT_PRIVILEDGE_FT_UPLOAD			= (1 << 24),
	RT_PRIVILEDGE_FT_DOWNLOAD		= (1 << 23),

	RT_PRIVILEDGE_CHAT_PUBLIC		= (1 << 22),
	RT_PRIVILEDGE_CHAT_PRIVATE		= (1 << 21),       

	RT_PRIVILEDGE_QA_CREATE			= (1 << 20),
	RT_PRIVILEDGE_RECORD_RECORD		= (1 << 19),

	RT_PRIVILEDGE_CONF_LAYOUT		= (1 << 18),

	RT_PRIVILEDGE_CONF_SUB			= (1 << 17),

	RT_PRIVILEDGE_PLAYER			= (1 << 0),
};

#define RT_PRIVILEDGE_ALL					(RT_PRIVILEDGE_AV_AUDIO|\
											RT_PRIVILEDGE_AV_VIDEO|\
											RT_PRIVILEDGE_AV_LOOP|\
											RT_PRIVILEDGE_DS_DOCUMENT|\
											RT_PRIVILEDGE_DS_ANNOTATION|\
											RT_PRIVILEDGE_DS_PAGE|\
											RT_PRIVILEDGE_DS_SAVE|\
											RT_PRIVILEDGE_FT_UPLOAD|\
											RT_PRIVILEDGE_FT_DOWNLOAD|\
											RT_PRIVILEDGE_CHAT_PUBLIC|\
											RT_PRIVILEDGE_CHAT_PRIVATE|\
											RT_PRIVILEDGE_QA_CREATE|\
											RT_PRIVILEDGE_RECORD_RECORD|\
											RT_PRIVILEDGE_CONF_SUB)

#define PRI_PRIVILEDGE_HOST					RT_PRIVILEDGE_ALL

#define PRI_PRIVILEDGE_PRESENTOR			RT_PRIVILEDGE_ALL

#define PRI_PRIVILEDGE_ASSISTANT			RT_PRIVILEDGE_ALL


#define RT_PRIVILEDGE_AV_MASK				(RT_PRIVILEDGE_AV_AUDIO|\
											RT_PRIVILEDGE_AV_VIDEO|\
											RT_PRIVILEDGE_AV_LOOP)

#define RT_PRIVILEDGE_DS_MASK				(RT_PRIVILEDGE_DS_DOCUMENT|\
											RT_PRIVILEDGE_DS_ANNOTATION|\
											RT_PRIVILEDGE_DS_PAGE|\
											RT_PRIVILEDGE_DS_SAVE)

#define RT_PRIVILEDGE_FT_MASK				(RT_PRIVILEDGE_FT_UPLOAD|\
											RT_PRIVILEDGE_FT_DOWNLOAD)

#define RT_PRIVILEDGE_CHAT_MASK				(RT_PRIVILEDGE_CHAT_PUBLIC|\
											RT_PRIVILEDGE_CHAT_PRIVATE)

#define RT_PRIVILEDGE_QA_MASK				(RT_PRIVILEDGE_QA_CREATE)

#define RT_PRIVILEDGE_RECORD_MASK			(RT_PRIVILEDGE_RECORD_RECORD)

#define RT_PRIVILEDGE_PLAYER_MASK			(RT_PRIVILEDGE_PLAYER)

#define RT_PRIVILEDGE_MASK					(RT_PRIVILEDGE_AV_MASK|\
											RT_PRIVILEDGE_DS_MASK|\
											RT_PRIVILEDGE_FT_MASK|\
											RT_PRIVILEDGE_CHAT_MASK|\
											RT_PRIVILEDGE_QA_MASK|\
											RT_PRIVILEDGE_RECORD_MASK|\
											RT_PRIVILEDGE_PLAYER_MASK|\
											RT_PRIVILEDGE_CONF_LAYOUT|\
											RT_PRIVILEDGE_CONF_SUB)


enum INFO_STATUS
{
	RT_STATE_RESOURCE_VIDEO		= (1 << 31),
	RT_STATE_RESOURCE_AUDIO		= (1 << 30),
	RT_STATE_NEW_VIDEO			= (1 << 29),
	RT_STATE_NEW_VIDEO_RQ		= (1 << 28),
	RT_STATE_NEW_AUDIO			= (1 << 27),
	RT_STATE_NEW_AUDIO_RQ		= (1 << 26),
	RT_STATE_NEW_AUDIO_MUTE		= (1 << 25),
	RT_STATE_NEW_VIDEO_SYNC		= (1 << 24),
	RT_STATE_NEW_VIDEO_LOOP		= (1 << 23),
	RT_STATE_NEW_HAND			= (1 << 22),
	RT_STATE_NEW_SUB			= (1 << 21),
};

enum
{
	RT_NODE_TYPE_USER = 0x0001,
	RT_NODE_TYPE_SUP_NODE = 0x0002,
	RT_NODE_TYPE_SUB_SVR_NODE = 0x0010
};

enum
{
    RT_SPEAK = (1 << 0),
	RT_SPEAK_ANNOTATION = (1 << 1),
    RT_SPEAK_VIDEO = (1 << 2),
	RT_SPEAK_AUDIO = (1 << 3),
	
};

#ifndef IL_FT_STATUS_DEF
#define IL_FT_STATUS_DEF
typedef enum
{
	RT_FT_STATUS_PROCESS,
	RT_FT_STATUS_FINISHED,
	RT_FT_STATUS_FAILED,
	RT_FT_STATUS_SHARE_CANCEL,
	RT_FT_STATUS_RECEIVE_CANCEL
} IL_FT_STATUS;
#endif


#endif

